<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="utf-8">
  

  
  <title>IPV6 | 章军的博客</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="IPv6 的概述ipv6 采用 128 bit 的地址长度　。来代替现在地址资源即将枯竭的　ipv4 。 2 IPv6 地址ipv6 采用　128 bit 的地址长度 , 格式为">
<meta name="keywords" content="Bolg">
<meta property="og:type" content="article">
<meta property="og:title" content="IPV6">
<meta property="og:url" content="http://octopuscloud.top/2019/08/04/IPV6/index.html">
<meta property="og:site_name" content="章军的博客">
<meta property="og:description" content="IPv6 的概述ipv6 采用 128 bit 的地址长度　。来代替现在地址资源即将枯竭的　ipv4 。 2 IPv6 地址ipv6 采用　128 bit 的地址长度 , 格式为">
<meta property="og:locale" content="China">
<meta property="og:updated_time" content="2019-09-11T04:27:11.296Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="IPV6">
<meta name="twitter:description" content="IPv6 的概述ipv6 采用 128 bit 的地址长度　。来代替现在地址资源即将枯竭的　ipv4 。 2 IPv6 地址ipv6 采用　128 bit 的地址长度 , 格式为">
  
    <link rel="alternate" href="/atom.xml" title="章军的博客" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
</head>
</html>
<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">章军的博客</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://octopuscloud.top"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-IPV6" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2019/08/04/IPV6/" class="article-date">
  <time datetime="2019-08-04T03:47:01.000Z" itemprop="datePublished">2019-08-04</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      IPV6
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="IPv6-的概述"><a href="#IPv6-的概述" class="headerlink" title="IPv6 的概述"></a>IPv6 的概述</h1><pre><code>ipv6 采用 128 bit 的地址长度　。来代替现在地址资源即将枯竭的　ipv4 。
</code></pre><h1 id="2-IPv6-地址"><a href="#2-IPv6-地址" class="headerlink" title="2 IPv6 地址"></a>2 IPv6 地址</h1><pre><code>ipv6 采用　128 bit 的地址长度 , 格式为 
</code></pre><a id="more"></a>
<h2 id="2-1-IPv6-的地址类型"><a href="#2-1-IPv6-的地址类型" class="headerlink" title="2.1　IPv6 的地址类型"></a>2.1　IPv6 的地址类型</h2><pre><code>IPv6 地址分可以分为三类: 单播 (unicast) , 任播 (Anycast)　, 多播 (Multicast) .
单播: 发送给指定的代表接口的单播地址 。
任播: 发送给任播地址中距离最近的那个　。
多播: 发送给多播地址代表的所有地址　。
ipv6 中用多播来替代　ipv4 中的广播 。
</code></pre><h2 id="2-2-IPv6-写法及其前缀格式"><a href="#2-2-IPv6-写法及其前缀格式" class="headerlink" title="2.2 IPv6 写法及其前缀格式"></a>2.2 IPv6 写法及其前缀格式</h2><pre><code>a. XX:XX:XX:XX:XX:XX:XX:XX , 其中 XX 代表这一个十六进制的数 , 例如 :
    FEDC:BA98:7654:3210:FEDC:BA98:7654:3210 ,
    1080:0:0:0:8:800:200C:417A

b. 压缩 0 的写法 , 用 :: 代表多个　16 进制的 0 , 例如 :
    压缩前 :
    1080:0:0:0:8:800:200C:417A  a unicast address
    FF01:0:0:0:0:0:0:101        a multicast address
    0:0:0:0:0:0:0:1             the loopback address
    0:0:0:0:0:0:0:0             the unspecified addresses

    压缩后 :
    1080::8:800:200C:417A       a unicast address
    FF01::101                   a multicast address
    ::1                         the loopback address
    ::                          the unspecified addresses

c. ipv6 和　ipv4 的压缩０的混合写法 , 例如:
    压缩前 :
    0:0:0:0:0:0:13.1.68.3
    0:0:0:0:0:FFFF:129.144.52.38

    压缩后 :
    ::13.1.68.3
    ::FFFF:129.144.52.38

前缀格式为 ipv6 address/prefix, 例如:
    12AB:0000:0000:CD30:0000:0000:0000:0000/60
    12AB::CD30:0:0:0:0/60
    12AB:0:0:CD30::/60
</code></pre><h2 id="2-3-IPv6-的单播地址的格式"><a href="#2-3-IPv6-的单播地址的格式" class="headerlink" title="2.3 IPv6 的单播地址的格式"></a>2.3 IPv6 的单播地址的格式</h2><pre><code>IPv6 的用连续的位掩码来聚合 , 类似于 IPv4 的　CIDR . IPv6 的单播地址有多个格式 :
1. global aggregatable global unicast address
2. the NSAP address 
3. the IPX hierarchical address
4. the site-local address
5. the link-local address
6.  the IPv4-capable host address

IPv6 的节点可以根据节点所扮演的角色来决定对 IPv6 地址的内部结构来进行理解 , 最低的限度下 , 可以认为 IPv6 地址没有内部结构 :
|                         128 bits                                |
+-----------------------------------------------------------------+
|                           node address                          |
+-----------------------------------------------------------------+

接口标识码有 64 bit 长度来组成 IEEE-EUI64 格式 , 格式的前三个的八位字节如下图:

+----+----+----+----+----+----+
|cccc|ccug|cccc|cccc|cccc|cccc|
+----+----+----+----+----+----+
u: u=1, 表示全球范围, u=0, 表示本地范围 .
g: g=1, 表示个人， u=0, 表示组织范围
c:  company_id 

 0:0:0:0:0:0:0:0 为未指定地址,  0:0:0:0:0:0:0:1 回环地址. 
</code></pre><h3 id="2-3-1-嵌入-IPv4-的-IPv6-的地址"><a href="#2-3-1-嵌入-IPv4-的-IPv6-的地址" class="headerlink" title="2.3.1 嵌入 IPv4 的 IPv6 的地址"></a>2.3.1 嵌入 IPv4 的 IPv6 的地址</h3><pre><code>IPv6 的转换机制包含一种对于路由和主机的技术，这种技术能够在 IPv4 的基础设施上同步 IPV6 的隧道包 。由这种机制分配的特殊的 IPv6 单播包
， 地址的后 32 为包含 IPv4 地址 。格式如下
| 80 bits                              | 16 |      32 bits        |
+--------------------------------------+--------------------------+
|0000..............................0000|0000|    IPv4 address     |
+--------------------------------------+----+---------------------+

另外一种类型为嵌入 IPv4 的 IPv6 地址， 用来表示这个节点只是一个只支持 IPv4 的节点的 IPv6 的地址。
| 80 bits                              | 16 |      32 bits        |
+--------------------------------------+--------------------------+
|0000..............................0000|FFFF|    IPv4 address     |
+--------------------------------------+----+---------------------+
</code></pre><h3 id="2-3-2-NASP-地址"><a href="#2-3-2-NASP-地址" class="headerlink" title="2.3.2 NASP 地址"></a>2.3.2 NASP 地址</h3><h3 id="2-3-3-IPX-地址"><a href="#2-3-3-IPX-地址" class="headerlink" title="2.3.3  IPX 地址"></a>2.3.3  IPX 地址</h3><pre><code>此处定义还在研究中
|   7   |                    121 bits                             |
+-------+---------------------------------------------------------+
|0000010|                  to be defined                          |
+-------+---------------------------------------------------------+
</code></pre><h3 id="2-3-4-可聚合全局单播地址"><a href="#2-3-4-可聚合全局单播地址" class="headerlink" title="2.3.4 可聚合全局单播地址"></a>2.3.4 可聚合全局单播地址</h3><pre><code>| 3|  13 | 8 | 24     |    16  | 64 bits                        |
+--+-----+---+--------+--------+--------------------------------+
|FP| TLA |RES| NLA    | SLA    |         Interface ID           |
|  | ID  |   | ID     | ID     |                                |
+--+-----+---+--------+--------+--------------------------------+

001     : Format Prefix (3 bit) for Aggregatable Global
          Unicast Addresses
TLA ID  : Top-Level Aggregation Identifier
RES     : Reserved for future use
NLA ID  : Next-Level Aggregation Identifier
SLA ID  : Site-Level Aggregation Identifier
INTERFACE ID:  Interface Identifier
</code></pre><h3 id="2-3-5-本地使用单播地址"><a href="#2-3-5-本地使用单播地址" class="headerlink" title="2.3.5 本地使用单播地址"></a>2.3.5 本地使用单播地址</h3><pre><code>local-use 地址右分为两类，分别为 link-local 和 site-local, link-local 给单个链接使用,
site-local 给单个站点使用. link-local 格式为:
| 10       |  
| bits     | 54 bits                 | 64 bits                    |
+----------+-------------------------+----------------------------+
|1111111010| 0                       | interface ID               |
+----------+-------------------------+----------------------------+

站点地址用来不需要全局前缀的情况下的内部站点寻址，路由器不应该转发以 site-locale 作为源地址或者
目标地址的包.
| 10       |  
| bits     | 54 bits                 | 64 bits                    |
+----------+-------------------------+----------------------------+
|1111111010| 0                       | interface ID               |
+----------+-------------------------+----------------------------+
</code></pre><h2 id="2-4-任播地址"><a href="#2-4-任播地址" class="headerlink" title="2.4 任播地址"></a>2.4 任播地址</h2><pre><code>  任播地址会被分配给多个接口，发送给多播地址的网络帧会被发送给距离路由最近的具有任播地址的接口，任播地址的格式和单播地址相同。
一个单播地址被分配给多个接口，则这个单播地址转换为任播地址。
</code></pre><h2 id="2-5-多播地址"><a href="#2-5-多播地址" class="headerlink" title="2.5 多播地址"></a>2.5 多播地址</h2><pre><code>  多播地址代表一组节点，一个节点可以属于任意数量的多播地址。格式如下 .
| 8      | 4  | 4  | 112 bits                                    |
+------ -+----+----+---------------------------------------------+
|11111111|flgs|scop|    group ID                                 |
+--------+----+----+---------------------------------------------+

flags 有 4bit 的结构，前 3bit 当前是保留的， 需要被初始化为 0. T = 0, 表示这个多播地址是是固定分配的，有专业组织认证的。
T = 1， 表示当前地址为临时分配的。
+-+-+-+-+
|0|0|0|T|
+-+-+-+-+

scope: 4 bit 的字节位来表示当前地址代表的范围. 值如下:
0 - reserved         ## 1 - node-local scope ## 2 - link-local scope ## 3 - (unassigned)              ## 4 - (unassigned)
5 - site-local scope ## 6 - (unassigned)     ## 7 - (unassigned)     ## 8 - organization-local scope
9 - (unassigned)     ## A - (unassigned)     ## B - (unassigned)     ## C - (unassigned)              ## D - (unassigned)
E - global scope     ## F - reserved

| 8      | 4  | 4  | 80 bits                   | 32 bits         |
+------ -+----+----+---------------------------+-----------------+
|11111111|flgs|scop| reserved must be zero     | group ID        |
+--------+----+----+---------------------------+-----------------+
</code></pre><h1 id="3-ICMPv6"><a href="#3-ICMPv6" class="headerlink" title="3 ICMPv6"></a>3 ICMPv6</h1><p>###　Route Advertisement</p>
<h3 id="Neighbour-Discover-Protocol"><a href="#Neighbour-Discover-Protocol" class="headerlink" title="Neighbour Discover Protocol"></a>Neighbour Discover Protocol</h3><hr>
<p>1.<a href="https://tools.ietf.org/html/rfc2373" target="_blank" rel="noopener">https://tools.ietf.org/html/rfc2373</a><br>2.<a href="https://tools.ietf.org/html/rfc2460#ref-ADDRARCH" target="_blank" rel="noopener">https://tools.ietf.org/html/rfc2460#ref-ADDRARCH</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://octopuscloud.top/2019/08/04/IPV6/" data-id="ck471vq0k000g32fzj71qql3e" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2019/08/04/IPv6 Frame Format/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          IPV6 Frame Format
        
      </div>
    </a>
  
  
    <a href="/2019/07/07/以太网帧-格式/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">以太网帧的类型及其区分</div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Categories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/RFC/">RFC</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/RFC-protocol/">RFC protocol</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/ReadNote/">ReadNote</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/linux/">linux</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/protocols/">protocols</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/tools/">tools</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/C/">C</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Data-Struct/">Data Struct</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Ethernet-II/">Ethernet II</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Frame-Format/">Frame Format</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/I2C/">I2C</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/IPv6/">IPv6</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Neighbour-Discover-Protocol/">Neighbour Discover Protocol</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/RFC/">RFC</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/SNMP/">SNMP</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/arthmetic/">arthmetic</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cgdb/">cgdb</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/chapter-15/">chapter 15</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/data-struct/">data struct</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/deb/">deb</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/defalt-path-for-so-file/">defalt path for so file</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/editer/">editer</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/file-system/">file system</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gdb-debug/">gdb debug</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hash/">hash</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/">linux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux-driver/">linux driver</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/platform-bus/">platform bus</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pointer-array/">pointer, array</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pseudocode/">pseudocode</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rb-tree/">rb tree</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sort/">sort</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ssh-key/">ssh key</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/symbol/">symbol</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/tool/">tool</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/tools/">tools</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/图/">图</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/通信协议/">通信协议</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/C/" style="font-size: 10px;">C</a> <a href="/tags/Data-Struct/" style="font-size: 10px;">Data Struct</a> <a href="/tags/Ethernet-II/" style="font-size: 10px;">Ethernet II</a> <a href="/tags/Frame-Format/" style="font-size: 10px;">Frame Format</a> <a href="/tags/I2C/" style="font-size: 10px;">I2C</a> <a href="/tags/IPv6/" style="font-size: 15px;">IPv6</a> <a href="/tags/Neighbour-Discover-Protocol/" style="font-size: 10px;">Neighbour Discover Protocol</a> <a href="/tags/RFC/" style="font-size: 10px;">RFC</a> <a href="/tags/SNMP/" style="font-size: 10px;">SNMP</a> <a href="/tags/arthmetic/" style="font-size: 10px;">arthmetic</a> <a href="/tags/cgdb/" style="font-size: 10px;">cgdb</a> <a href="/tags/chapter-15/" style="font-size: 10px;">chapter 15</a> <a href="/tags/data-struct/" style="font-size: 15px;">data struct</a> <a href="/tags/deb/" style="font-size: 10px;">deb</a> <a href="/tags/defalt-path-for-so-file/" style="font-size: 10px;">defalt path for so file</a> <a href="/tags/editer/" style="font-size: 10px;">editer</a> <a href="/tags/file-system/" style="font-size: 10px;">file system</a> <a href="/tags/gdb-debug/" style="font-size: 10px;">gdb debug</a> <a href="/tags/hash/" style="font-size: 10px;">hash</a> <a href="/tags/linux/" style="font-size: 20px;">linux</a> <a href="/tags/linux-driver/" style="font-size: 10px;">linux driver</a> <a href="/tags/platform-bus/" style="font-size: 10px;">platform bus</a> <a href="/tags/pointer-array/" style="font-size: 10px;">pointer, array</a> <a href="/tags/pseudocode/" style="font-size: 10px;">pseudocode</a> <a href="/tags/rb-tree/" style="font-size: 10px;">rb tree</a> <a href="/tags/sort/" style="font-size: 20px;">sort</a> <a href="/tags/ssh-key/" style="font-size: 10px;">ssh key</a> <a href="/tags/symbol/" style="font-size: 10px;">symbol</a> <a href="/tags/tool/" style="font-size: 10px;">tool</a> <a href="/tags/tools/" style="font-size: 10px;">tools</a> <a href="/tags/图/" style="font-size: 10px;">图</a> <a href="/tags/通信协议/" style="font-size: 10px;">通信协议</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/12/">December 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/11/">November 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/10/">October 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/09/">September 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/08/">August 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/07/">July 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/06/">June 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/05/">May 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/04/">April 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/03/">March 2019</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2019/12/15/TMUX-使用/">TMUX-使用</a>
          </li>
        
          <li>
            <a href="/2019/11/02/linux-platform-bus-总线分析/platform/">(no title)</a>
          </li>
        
          <li>
            <a href="/2019/11/02/十二章-二叉搜索树/">算法导论-第十二章 二叉查找树</a>
          </li>
        
          <li>
            <a href="/2019/11/02/SegmentationFault-Debug/">(no title)</a>
          </li>
        
          <li>
            <a href="/2019/10/19/linux-platform-bus-总线分析/">linux platform bus 总线分析</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2019 zhangjun<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>



  </div>
</body>
</html>